

package cn.shengchao.examstar.distribute.infrastrure.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.shengchao.examstar.rpc.distribute.enums.DistributeOrderTaskStatusDataStatusEnum;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.shengchao.examstar.distribute.infrastrure.po.DistributeOrderTask;
import cn.shengchao.examstar.distribute.infrastrure.mapper.DistributeOrderTaskMapper;
import cn.shengchao.examstar.distribute.infrastrure.service.DistributeOrderTaskService;

import java.util.List;

@Service
public class DistributeOrderTaskServiceImpl extends ServiceImpl<DistributeOrderTaskMapper, DistributeOrderTask> implements DistributeOrderTaskService {
    @Override
    public Boolean changeDataStatus(List<Long> list, DistributeOrderTaskStatusDataStatusEnum distributeOrderTaskStatusDataStatusEnum) {
        if (CollUtil.isNotEmpty(list)) {
            list.forEach(id -> {
                DistributeOrderTask distributeOrderTask = new DistributeOrderTask();
                distributeOrderTask.setId(id);
                distributeOrderTask.setDataStatus(distributeOrderTaskStatusDataStatusEnum.getStatus());
                this.updateById(distributeOrderTask);
            });
            return true;
        }
        return false;
    }
}
